package com.lenovo.leos.filebrowser.netdisk;

import android.os.Bundle;


// [check] no need to add a function clone()
public class NetDiskOp extends Object {
	private static final String TAG = "NetDiskOp";
	
	public static final long INVALID_ID = -1;
	
	// use to create a new ID for every new object
	private static long slMaxID = 0;
	
	private long mlID = INVALID_ID ;
	private Bundle mData = null;
	private String msResult = null;
		
	// [improve] may use a function createID to get new ID
	public NetDiskOp(Bundle data) {
		if (null == data){
			Log.e(TAG, "data is null in NetDiskOp");
		}else{
			mlID = ++slMaxID;	
			mData = data;
		}
	}
	
	public long getID() {
		return mlID;
	}
	
	public String getResult() {
		return msResult;
	}
	
	public void setResult(String result){
		if (null == result || 0 ==result.trim().length())
			Log.e(TAG, "invalid result in setResult");
		else
			msResult = result;
	}
	
	public Bundle getData(){
		return mData;
	}

	@Override
	protected Object clone() throws CloneNotSupportedException {
		
		NetDiskOp o = null; 
		
        try {  
            o = (NetDiskOp) super.clone();
            o.mlID = mlID;
            o.mData = (Bundle) mData.clone();
            o.msResult = msResult;
            
        } catch (CloneNotSupportedException e) {  
            e.printStackTrace();  
        }  
        
		return o;
	}
}
